<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script src="vue.js"></script>
</head>
<body>
	<div id="root">
		<component :is="type"></component>
		<button @click="clickMethod">点击切换</button>
	</div>
</body>
<script>
	Vue.component('child-one',{
		template:'<div>this is one</div>',
	})
	Vue.component('child-two',{
		template:'<div>this is two</div>',
	})
	var vm=new Vue({
		el:'#root',
		data:{
			type:'child-one'
		},
		methods:{
			clickMethod:function(){
				this.type=(this.type==='child-one'?'child-two':'child-one')
			}
		}
	})
</script>
</html>